/*
 * A button with small font size like `isSmall` and reduced padding:
 * 4px instead of 6px vertical
 * 8px instead of 16px horizontal
 */
.pf-v5-c-button.pf-m-smaller {
    --pf-v5-c-button--FontSize: var(--pf-v5-global--FontSize--sm);
    --pf-v5-c-button--PaddingTop: var(--pf-v5-global--spacer--xs);
    --pf-v5-c-button--PaddingRight: var(--pf-v5-global--spacer--sm);
    --pf-v5-c-button--PaddingBottom: var(--pf-v5-global--spacer--xs);
    --pf-v5-c-button--PaddingLeft: var(--pf-v5-global--spacer--sm);
}

/*
 * Dropdown has (via className) font size compatible with Button (see above).
 */
.pf-v5-c-dropdown.pf-m-smaller {
    --pf-v5-c-dropdown__toggle--FontSize: var(--pf-v5-global--FontSize--sm);
    --pf-v5-c-dropdown__toggle--PaddingTop: var(--pf-v5-global--spacer--xs);
    --pf-v5-c-dropdown__toggle--PaddingRight: var(--pf-v5-global--spacer--sm);
    --pf-v5-c-dropdown__toggle--PaddingBottom: var(--pf-v5-global--spacer--xs);
    --pf-v5-c-dropdown__toggle--PaddingLeft: var(--pf-v5-global--spacer--sm);
    --pf-v5-c-dropdown__toggle-icon--MarginLeft: var(--pf-v5-global--spacer--sm);
    --pf-v5-c-dropdown__toggle-icon--MarginRight: 0;
    --pf-v5-c-dropdown__menu-item--FontSize: var(--pf-v5-global--FontSize--sm);
    --pf-v5-c-dropdown__menu-item--PaddingTop: calc(var(--pf-v5-global--spacer--sm) / 2);
    --pf-v5-c-dropdown__menu-item--PaddingRight: var(--pf-v5-global--spacer--sm);
    --pf-v5-c-dropdown__menu-item--PaddingBottom: calc(var(--pf-v5-global--spacer--sm) / 2);
    --pf-v5-c-dropdown__menu-item--PaddingLeft: var(--pf-v5-global--spacer--sm);
}

/*
 * ToggleGroupItem button that is disabled needs lighter background like any other form control.
 */
 button.pf-v5-c-toggle-group__button:disabled {
    background-color: var(--pf-v5-global--disabled-color--300);
}

/*
 * ToggleGroupItem button that is disabled and selected needs more contrast to distinguish from unselected button.
 */
button.pf-v5-c-toggle-group__button.pf-m-selected:disabled {
    background-color: var(--pf-v5-c-toggle-group__button--m-selected--BackgroundColor);
}

/*
 * Inherit same color as rest of masthead, instead of blue.
 */
a[href="/main/search"] {
    color: inherit;
}

/*
 * Popover baseline style rule has .pf-v5-c-popover__close + * selector.
 *
 * Adjust padding for bodyContent={<PopoverBodyContent headerContent={…} />} prop,
 * because accessibility work-around renders header as child of body instead of sibling preceding body.
 *
 * https://developer.mozilla.org/en-US/docs/Web/CSS/:has#browser_compatibility
 */

.pf-v5-c-popover__close + .pf-v5-c-popover__body:has(> .pf-v5-c-popover__header) {
    padding-inline-end: 0;
}

.pf-v5-c-popover__close + .pf-v5-c-popover__body > .pf-v5-c-popover__header {
    padding-inline-end: var(--pf-v5-c-popover__close--sibling--PaddingRight);
}

/*
 * Fix lack of color contrast in label of ChromePicker element.
 */
.chrome-picker input,
.chrome-picker label {
    color: var(--pf-v5-global--Color--100) !important; /* instead of #969696 */
}


/*
 * Forces the main dashboard to display a scrollbar unconditionally. This is needed to prevent an infinite
 * screen flicker at specific screen resolutions where the Victory chart resize observer triggers a resize event
 * infinitely and shifts the grid layout between 2x3 and 3x2.
 */
#main-page-container > div:has(#main-dashboard-widget-gallery) {
    overflow-y: scroll !important;
}
